
div { 
    width: 50px;
    height: 50px;
   
    /* padding: 5px; */
    float: left;
    background-color: yellow;
    box-sizing: border-box;
}
div:nth-child(even)>div:nth-child(odd),div:nth-child(odd)>div:nth-child(even){
    background-color: green;
}
div>div{
    padding: 10px;
}
div>div:hover:after{
 content: " ";
 display: block;
width: 100%;
height: 100%;
/* padding: 15px; */
/* box-sizing: border-box; */
background-color: red;
}

div:nth-child(odd)>div:nth-child(even):hover::after,div:nth-child(even)>div:nth-child(odd):hover::after{
    content: " ";
    display: block;
     width: 100%;
    height: 100%; 
  background-color: black;     
}




